"""
    Pinterest REST API

    Pinterest's REST API  # noqa: E501

    The version of the OpenAPI document: 5.6.0
    Contact: pinterest-api@pinterest.com
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from pinterest.generated.client.api_client import ApiClient, Endpoint as _Endpoint
from pinterest.generated.client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from pinterest.generated.client.model.ad_accounts_country_response import AdAccountsCountryResponse
from pinterest.generated.client.model.book_closed_response import BookClosedResponse
from pinterest.generated.client.model.delivery_metrics_response import DeliveryMetricsResponse
from pinterest.generated.client.model.error import Error
from pinterest.generated.client.model.single_interest_targeting_option_response import SingleInterestTargetingOptionResponse
from pinterest.generated.client.model.targeting_option_response import TargetingOptionResponse


class ResourcesApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client
        self.ad_account_countries_get_endpoint = _Endpoint(
            settings={
                'response_type': (AdAccountsCountryResponse,),
                'auth': [
                    'pinterest_oauth2'
                ],
                'endpoint_path': '/resources/ad_account_countries',
                'operation_id': 'ad_account_countries_get',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                ],
                'required': [],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                },
                'attribute_map': {
                },
                'location_map': {
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.delivery_metrics_get_endpoint = _Endpoint(
            settings={
                'response_type': (DeliveryMetricsResponse,),
                'auth': [
                    'pinterest_oauth2'
                ],
                'endpoint_path': '/resources/delivery_metrics',
                'operation_id': 'delivery_metrics_get',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'report_type',
                ],
                'required': [],
                'nullable': [
                ],
                'enum': [
                    'report_type',
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                    ('report_type',): {

                        "SYNC": "SYNC",
                        "ASYNC": "ASYNC"
                    },
                },
                'openapi_types': {
                    'report_type':
                        (str,),
                },
                'attribute_map': {
                    'report_type': 'report_type',
                },
                'location_map': {
                    'report_type': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.interest_targeting_options_get_endpoint = _Endpoint(
            settings={
                'response_type': (SingleInterestTargetingOptionResponse,),
                'auth': [
                    'pinterest_oauth2'
                ],
                'endpoint_path': '/resources/targeting/interests/{interest_id}',
                'operation_id': 'interest_targeting_options_get',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'interest_id',
                ],
                'required': [
                    'interest_id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'interest_id',
                ]
            },
            root_map={
                'validations': {
                    ('interest_id',): {
                        'max_length': 18,
                        'regex': {
                            'pattern': r'^\d+$',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'interest_id':
                        (str,),
                },
                'attribute_map': {
                    'interest_id': 'interest_id',
                },
                'location_map': {
                    'interest_id': 'path',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.metrics_ready_state_get_endpoint = _Endpoint(
            settings={
                'response_type': (BookClosedResponse,),
                'auth': [
                    'pinterest_oauth2'
                ],
                'endpoint_path': '/resources/metrics_ready_state',
                'operation_id': 'metrics_ready_state_get',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'date',
                ],
                'required': [
                    'date',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'date',
                ]
            },
            root_map={
                'validations': {
                    ('date',): {

                        'regex': {
                            'pattern': r'^(\d{4})-(\d{2})-(\d{2})$',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'date':
                        (str,),
                },
                'attribute_map': {
                    'date': 'date',
                },
                'location_map': {
                    'date': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.targeting_options_get_endpoint = _Endpoint(
            settings={
                'response_type': (TargetingOptionResponse,),
                'auth': [
                    'pinterest_oauth2'
                ],
                'endpoint_path': '/resources/targeting/{targeting_type}',
                'operation_id': 'targeting_options_get',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'targeting_type',
                    'client_id',
                    'oauth_signature',
                    'timestamp',
                ],
                'required': [
                    'targeting_type',
                ],
                'nullable': [
                ],
                'enum': [
                    'targeting_type',
                ],
                'validation': [
                    'client_id',
                    'timestamp',
                ]
            },
            root_map={
                'validations': {
                    ('client_id',): {
                        'max_length': 18,
                        'regex': {
                            'pattern': r'^\d+$',  # noqa: E501
                        },
                    },
                    ('timestamp',): {

                        'regex': {
                            'pattern': r'd+/',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                    ('targeting_type',): {

                        "APPTYPE": "APPTYPE",
                        "GENDER": "GENDER",
                        "LOCALE": "LOCALE",
                        "AGE_BUCKET": "AGE_BUCKET",
                        "LOCATION": "LOCATION",
                        "GEO": "GEO",
                        "INTEREST": "INTEREST",
                        "KEYWORD": "KEYWORD",
                        "AUDIENCE_INCLUDE": "AUDIENCE_INCLUDE",
                        "AUDIENCE_EXCLUDE": "AUDIENCE_EXCLUDE"
                    },
                },
                'openapi_types': {
                    'targeting_type':
                        (str,),
                    'client_id':
                        (str,),
                    'oauth_signature':
                        (str,),
                    'timestamp':
                        (str,),
                },
                'attribute_map': {
                    'targeting_type': 'targeting_type',
                    'client_id': 'client_id',
                    'oauth_signature': 'oauth_signature',
                    'timestamp': 'timestamp',
                },
                'location_map': {
                    'targeting_type': 'path',
                    'client_id': 'query',
                    'oauth_signature': 'query',
                    'timestamp': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )

    def ad_account_countries_get(
        self,
        **kwargs
    ):
        """Get ad accounts countries  # noqa: E501

        Get Ad Accounts countries  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.ad_account_countries_get(async_req=True)
        >>> result = thread.get()


        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            AdAccountsCountryResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        return self.ad_account_countries_get_endpoint.call_with_http_info(**kwargs)

    def delivery_metrics_get(
        self,
        **kwargs
    ):
        """Get available delivery metrics' definitions  # noqa: E501

        <strong>This endpoint is currently in beta and not available to all apps. <a href='/docs/features/ads-management/'>Learn more</a>.</strong> <p/> Get the definitions for the delivery metrics available for synchronous or asynchronous reports.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.delivery_metrics_get(async_req=True)
        >>> result = thread.get()


        Keyword Args:
            report_type (str): Report type.. [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            DeliveryMetricsResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        return self.delivery_metrics_get_endpoint.call_with_http_info(**kwargs)

    def interest_targeting_options_get(
        self,
        interest_id,
        **kwargs
    ):
        """Get interest details  # noqa: E501

        <p>Get details of a specific interest given interest ID.</p> <p>Click <a href=\"https://docs.google.com/spreadsheets/d/1HxL-0Z3p2fgxis9YBP2HWC3tvPrs1hAuHDRtH-NJTIM/edit#gid=118370875\" target=\"_blank\">here</a> for a spreadsheet listing interests and their IDs.</p>  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.interest_targeting_options_get(interest_id, async_req=True)
        >>> result = thread.get()

        Args:
            interest_id (str): Unique identifier of an interest.

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            SingleInterestTargetingOptionResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['interest_id'] = \
            interest_id
        return self.interest_targeting_options_get_endpoint.call_with_http_info(**kwargs)

    def metrics_ready_state_get(
        self,
        date,
        **kwargs
    ):
        """Get metrics ready state  # noqa: E501

        <strong>This endpoint is currently in beta and not available to all apps. <a href='/docs/features/ads-management/'>Learn more</a>.</strong> <p/> Learn whether conversion or non-conversion metrics are finalized and ready to query.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.metrics_ready_state_get(date, async_req=True)
        >>> result = thread.get()

        Args:
            date (str): Analytics reports request date (UTC). Format: YYYY-MM-DD

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            BookClosedResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['date'] = \
            date
        return self.metrics_ready_state_get_endpoint.call_with_http_info(**kwargs)

    def targeting_options_get(
        self,
        targeting_type,
        **kwargs
    ):
        """Get targeting options  # noqa: E501

        <p>You can use targeting values in ads placement to define your intended audience. </p> <p>Targeting metrics are organized around targeting specifications.</p> <p>For more information on ads targeting, see <a class=\"reference external\" href=\"https://help.pinterest.com/en/business/article/audience-targeting\" target=\"_blank\">Audience targeting</a>.</p> <p><b>Sample return:</b></p> <pre class=\"literal-block\"> [{&quot;36313&quot;: &quot;Australia: Moreton Bay - North&quot;, &quot;124735&quot;: &quot;Canada: North Battleford&quot;, &quot;36109&quot;: &quot;Australia: Murray&quot;, &quot;36108&quot;: &quot;Australia: Mid North Coast&quot;, &quot;36101&quot;: &quot;Australia: Capital Region&quot;, &quot;811&quot;: &quot;U.S.: Reno&quot;, &quot;36103&quot;: &quot;Australia: Central West&quot;, &quot;36102&quot;: &quot;Australia: Central Coast&quot;, &quot;36105&quot;: &quot;Australia: Far West and Orana&quot;, &quot;36104&quot;: &quot;Australia: Coffs Harbour - Grafton&quot;, &quot;36107&quot;: &quot;Australia: Illawarra&quot;, &quot;36106&quot;: &quot;Australia: Hunter Valley Exc Newcastle&quot;, &quot;554017&quot;: &quot;New Zealand: Wanganui&quot;, &quot;554016&quot;: &quot;New Zealand: Marlborough&quot;, &quot;554015&quot;: &quot;New Zealand: Gisborne&quot;, &quot;554014&quot;: &quot;New Zealand: Tararua&quot;, &quot;554013&quot;: &quot;New Zealand: Invercargill&quot;, &quot;GR&quot;: &quot;Greece&quot;, &quot;554011&quot;: &quot;New Zealand: Whangarei&quot;, &quot;554010&quot;: &quot;New Zealand: Far North&quot;, &quot;717&quot;: &quot;U.S.: Quincy-Hannibal-Keokuk&quot;, &quot;716&quot;: &quot;U.S.: Baton Rouge&quot;,...}] </pre>  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.targeting_options_get(targeting_type, async_req=True)
        >>> result = thread.get()

        Args:
            targeting_type (str): Public targeting type.

        Keyword Args:
            client_id (str): Client ID.. [optional]
            oauth_signature (str): Oauth signature. [optional]
            timestamp (str): Timestamp. [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            TargetingOptionResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['targeting_type'] = \
            targeting_type
        return self.targeting_options_get_endpoint.call_with_http_info(**kwargs)

